//------------------------------------------------------------------------------
#ifndef MESSAGE_H
#define MESSAGE_H
//------------------------------------------------------------------------------
#include <QString>
#include <QDomDocument>
//------------------------------------------------------------------------------
#define DOM_DOCTYPE	"STNMessage"
#define DOM_ROOT_ELM	"msg"
//------------------------------------------------------------------------------
/*!
 * SysTray Notifier Message
 */
class STNMessage{
//------------------------------------------------------------------------------
	public:
		/*!
		 * Default constructor
		 */
		STNMessage();

		/*!
		 * Constructs a new message
		 */
		STNMessage(
			const QString &message,
			const QString &title,
			const QString &icon=QString(),
			const QString &program=QString()
		);

		/*!
		 * Copy constructor
		 */
		STNMessage(const STNMessage &src);

		/*!
		 * Assignment operator
		 */
		const STNMessage &operator=(const STNMessage &src);

		/*!
		 * Converts this message to a XML representation
		 * @return A string containing the XML representation of this message
		 */
		QString toXml() const;

		/*!
		 * Loads this message from a XML representation
		 * @param data XML data
		 * @return True if successfully loaded
		 */
		bool loadFromXml(const QString &data);

		// Setters
		void setMessage(const QString &value){ m_message = value; }
		void setTitle(const QString &value){ m_title = value; }
		void setIcon(const QString &value){ m_icon = value; }
		void setProgram(const QString &value){ m_program = value; }

		// Getters
		const QString &getMessage() const { return m_message; }
		const QString &getTitle() const { return m_title; }
		const QString &getIcon() const { return m_icon; }
		const QString &getProgram() const { return m_program; }
//------------------------------------------------------------------------------
	private:
		/*!
		 * Clones src into this object (returns object reference)
		 * Equivalent to assignement operator
		 */
		const STNMessage & clone(const STNMessage &src);

		// Members
		QString m_message;
		QString m_title;
		QString m_icon;
		QString m_program;
//------------------------------------------------------------------------------
};
//------------------------------------------------------------------------------
#endif // MESSAGE_H
//------------------------------------------------------------------------------
